package WaiBao;

import java.util.Arrays;

public class LiuWenYi {
    public static void main(String[] args) {
        String[] name = {"李晓雄(副班长)", "贾志雄(团支书)", "小李(学习委员)", "穆伟(纪律委员)", "李宁", "张小小", "李大大", "伯爵", "艾瑞克", "大卫", "阿超", "阿衰",
                "图图", "喜洋洋", "美羊羊", "沸羊羊", "懒洋洋", "村长", "灰太狼", "红太狼", "小灰灰", "智羊羊", "仍然", "任然", "花粥", "马宇阳", "郭碧晨", "李玟",
                "迪丽热巴", "刘文艺(班长)"};//考生本人:刘文艺(班长)
        int[] age = {19, 20, 20, 21, 22, 20, 19, 22, 21, 18, 21, 20, 20,22, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 18,20, 21};//考生本人年龄:21
        double[] benben1 = {84, 64, 76, 90, 94, 74, 78, 89, 81, 71, 91, 87, 85, 79, 65, 68, 99, 90, 86, 88, 92, 91, 95, 65, 75, 74, 90, 73, 84, 96};
        double[] benben2 = {74, 77, 61, 76, 80, 67, 84, 94, 73, 80, 85, 87, 66, 84, 65, 65, 76, 69, 76, 98, 72, 71, 95, 86, 75, 82, 88, 84, 71, 98};
        double[] benben3 = {87, 62, 84, 85, 75, 64, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 74, 85, 97};

        double lisha1 ;//代表每个学生的总分
        double lisha2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            lisha1  = benben1[i] + benben2[i] + benben3[i];
//            lisha2 = (lisha1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +lisha1);
//            System.out.println(name[i] + "的平均分为:" +lisha2);
//        }


        double mailang1 = 0,mailang2 = 0;
        double[] wanghou = new double[30];
//        for (int i = 0; i < 30; i++) {
//            mailang1= benben1[i] +  benben2[i] + benben3[i];
//            mailang2 = (mailang1* 1.0) / 3;
//            wanghou[i] =mailang2;
//        }
//
//        for (int i = 0; i < wanghou.length - 1; i++) {
//            for (int j = 0; j < wanghou.length - i - 1; j++) {
//                if (wanghou[j] <wanghou[j + 1]) {
//                    double tep =  wanghou[j];
//                    wanghou[j] = wanghou[j + 1];
//                    wanghou[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( wanghou[i]);
//        }

        double huazuo1 = 0, huazuo2 = 0,huazuo3 = 0;//计算每门课的平均分
        double jianpan1 = 0,jianpan2 = 0, jianpan3 = 0;//计算每门课标准差
        double chatou1 = 0, chatou2 = 0, chatou3 = 0;//计算每门课中位数
        double he = 0;
//        for (int i = 0; i < benben1.length; i++) {
//            he +=benben1[i];
//        }
//        huazuo1 = (he * 1.0) / 30;
//        System.out.println("农业设施及环境调控的班级平均分为:" + huazuo1);
//        double Sum = 0;
//        for (int i = 0; i < benben2.length; i++) {
//            Sum +=benben2[i];
//        }
//        huazuo2 = (Sum * 1.0) / 30;
//        System.out.println("农业设施设计与建造的班级平均分为:" +huazuo2);
//        double sum = 0;
//        for (int i = 0; i <benben3.length; i++) {
//            sum +=benben3[i];
//        }
//        huazuo3 = (sum * 1.0) / 30;
//        System.out.println("园艺植物设施栽培学的班级平均分为:" + huazuo3);
//
//
//
//        double c1 = 0, c2 = 0, c3 = 0;
//        for (int i = 0; i <benben1.length; i++) {
//            c1 += (benben1[i] - huazuo1) * (benben1[i] - huazuo1);
//        }
//        jianpan1 = Math.sqrt(c1*1.0/30);
//        System.out.println("农业设施及环境调控的班级标准差为:" + jianpan1);
//        for (int i = 0; i <benben2.length; i++) {
//            c2 += (benben2[i] - huazuo2) * (benben2[i] -huazuo2);
//        }
//        jianpan2 = Math.sqrt(c2*1.0/30);
//        System.out.println("农业设施设计与建造的班级标准差为:" +jianpan2);
//
//        for (int i = 0; i <benben3.length; i++) {
//            c3 += (benben3[i] - huazuo3) * (benben3[i] - huazuo3);
//        }
//        jianpan3 = Math.sqrt(c3*1.0/30);
//        System.out.println("园艺植物设施栽培学的标准差为:" + jianpan3);
////////////
        Arrays.sort(benben1);
        Arrays.sort(benben2);
        Arrays.sort(benben3);
        chatou1 = (benben1[15] +benben2[14]) * 1.0 / 2;
        chatou2 = (benben2[15] +benben2[14]) * 1.0 / 2;
        chatou3 = (benben3[15] +benben3[14]) * 1.0 / 2;
        System.out.println("农业设施及环境调控的中位数为:" + chatou1);
        System.out.println("农业设施设计与制造的中位数为:" + chatou2);
        System.out.println("园艺植物设施栽培学的中位数为:" + chatou3);



    }
}
